package com.com.ruandi.test15;

//三角形类
public class Triangle extends Graphic{
    private double a;
    private double b;
    private double c;

    public Triangle() {
    }
    public Triangle(double a, double b, double c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }

    public double getA() {
        return a;
    }

    public void setA(double a) {
        this.a = a;
    }

    public double getB() {
        return b;
    }

    public void setB(double b) {
        this.b = b;
    }

    public double getC() {
        return c;
    }

    public void setC(double c) {
        this.c = c;
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }

    @Override
    public String toString() {
        return "三角形\n" +
                "a=" + a +
                ", b=" + b +
                ", c=" + c
                +"\n";
    }

    @Override
    public boolean equals(Object obj) {
        return super.equals(obj);
    }
    //面积方法

    @Override
    public double getArea() {
        double p = (a+b+c)/2;
        return Math.sqrt(p*(p-a)*(p-b)*(p-c));
    }
    //周长方法
    @Override
    public double getPerimeter() {
        return a+b+c;
    }

    @Override
    public String showInfo() {
        return "三角形";
    }

}
